home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.input;
-
- import sub_arctic.lib.interactor;
-
- /**
- * This class implements the raw focus agent. This agent is focus based and
- * delivers raw events to requesting objects. This can be used as a hook for
- * extensions. This agent handles the raw_input_acceptor input protocol.
- *
- * @see sub_arctic.input.raw_input_acceptor
- * @author Scott Hudson
- */
- public class raw_focus_agent extends focus_dispatch_agent {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Simple constructor. */
- public raw_focus_agent()
- {
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Allow objects in this focus set only if they implement the
- * raw_input_acceptor interface.
- *
- * @param focusable candidate_obj the object we are testing for suitability.
- * @return boolean indicating if the object is suitable to go in the focus set
- */
- public boolean allowable_focus(focusable candidate_obj)
- {
- return candidate_obj instanceof raw_input_acceptor;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Attempt to dispatch an event under this agent.
- *
- * @param event evt the event to try to dispatch.
- * @param Object user_info ignored (since this is a focus agent).
- * @param interactor to_obj ignored (since this is a focus agent).
- * @param int seq_num ignored (since this is a focus agent).
- * @return boolean indicating whether the event was consumed.
- */
- public boolean dispatch_event(
- event evt,
- Object user_info,
- interactor to_obj,
- int seq_num)
- {
- int i;
- raw_input_acceptor dispatch_to_obj;
- boolean result = false;
- event evt_copy;
-
- /* copy event */
- evt_copy = new event(evt);
-
- /* do a dispatch of raw event to each element of the focus set */
- for (i = 0; i < focus_set_size(); i++)
- {
- /* extract the object and dispatch to it */
- dispatch_to_obj = (raw_input_acceptor)focus_item(i);
- if (dispatch_to_obj instanceof interactor)
- evt_copy.global_to_local((interactor)dispatch_to_obj);
- else
- evt_copy.reset_to_global();
- result |= dispatch_to_obj.handle_raw_input(evt_copy,user_info);
- }
- return result;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-